import rclpy
from rclpy.node import Node
from base_interfaces.msg import Student
class TalkerStu(Node):
    def __init__(self):
        super(). __init__ ("talkerstu_node_py")
        self.publisher=self.create_publisher(Student,"chatter_stu",10)
        self.timer=self.create_timer(1.0,self.on_timer)
        self.count=6
    def on_timer(self):
        message=Student()
        message.name="凹凸曼"
        message.age=self.count
        message.height=1.40
        self.publisher.publish(message)
        self.count+=1
        self.get_logger().info(f"这是学生信息,姓名：{message.name},年龄：{message.age}岁,身高：{message.height}米")
def main():
    rclpy.init()
    rclpy.spin(TalkerStu())
    rclpy.shutdown()

if __name__=="__main__":
    main()

    